<template>
  <div class="container">
    <div class="bac">
      <van-nav-bar
        class="arr"
        :title="data.nickname"
        left-text=""
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
        :border="false"
      >
        <van-icon slot="right" class="sr" name="ellipsis" />
        <van-icon slot="left" class="sr" name="arrow-left" />
      </van-nav-bar>
      <div class="headerimg" />
      <div class="header">
        <div class="left">
          <van-image width="100" height="100" round :src="data.avatarUrl" />
        </div>
        <div class="rieght">
          <div class="rtop">
            <div class="data-item">
              <span class="count">{{ data.followeds }}</span>
              <span class="text">粉丝</span>
            </div>
            <div class="data-item">
              <span class="count">{{ data.follows }}</span>
              <span class="text">关注</span>
            </div>
            <div class="data-item">
              <span class="count">LV{{ level }}</span>
              <span class="text">等级</span>
            </div>
          </div>
          <div class="rbottom">
            <van-button
              class="bjbtn"
              round
              type="info"
              @click="$router.push('/MyProfile')"
              >编辑信息</van-button
            >
          </div>
        </div>
      </div>
    </div>
    <van-tabs>
      <van-tab title="主页">
        <home-page :data="data" />
      </van-tab>
      <van-tab title="动态"><div class="doni">暂无相关信息</div></van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import HomePage from './components/homepage'
import { getlevel } from '@/api/PersonalDetails'
export default {
  data () {
    return {
      cookie: this.$store.state.cookie,
      level: '',
      data: ''
    }
  },
  created () {
    this.getlevel()
    this.getuserinfo()
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  methods: {
    onClickLeft () {
      this.$router.back()
    },
    onClickRight () {},
    async getlevel () {
      const { data } = await getlevel(this.cookie)
      // console.log()
      this.level = data.level
    },
    getuserinfo () {
      // const { profile } = await getuserinfo(this.cookie)
      // console.log(profile)
      this.data = this.userInfo
      // console.log(this.$store.getters.userInfo)
      console.log(this.userInfo)
    }
  },
  components: {
    HomePage
  }
}
</script>

<style scoped lang="less">
.container {
  // width: 100%;
  // position: relative;
  padding-top: 40px;
  padding-bottom: 30px;
  background: #f5f5f5;
  .arr {
    // position: absolute;
    position:fixed;
    top: 0;
    left: 0;
    width: 100%;
  }
  /deep/ .headerimg {
    height: 461px;
    background: url(~@/assets/pesonelimg.jpg) no-repeat;
    background-size: cover;
    .van-nav-bar {
      background-color: transparent;
      border-bottom: 0;
      border-bottom: -1px;
      .van-nav-bar__content {
        background-color: transparent;
        border: none;
        border-bottom: -1px;
        .van-nav-bar__title {
          color: #fff;
          font-weight: 700;
        }
        .sr {
          color: #fff;
          font-weight: 700;
          font-size: 39px;
        }
      }
    }
  }
  .header {
    // padding-top: 361px;
    display: flex;
    // height: 80px;
    justify-content: center;
    align-items: center;
    .left {
      flex: 1;
      margin: 0 15px;
      // padding: 15px;
    }
    .rieght {
      display: flex;
      flex-direction: column;
      flex: 3;
      // background: pink;
      padding: 20px;

      .rtop {
        display: flex;
        .data-item {
          flex: 1;
          display: flex;
          justify-content: center;
          flex-direction: column;
          align-items: center;
          color: #090707;
          font-size: 22px;
          .count {
            font-weight: 700;
          }
          .text {
            color: #5b5754;
          }
        }
      }
      /deep/.rbottom {
        margin-top: 5px;
        .bjbtn {
          width: 80%;
          height: 58px;
          margin: 0 48px;
          background: transparent;
          color: #343031;
          border-color: #dbd7d8;
        }
      }
    }
  }
  /deep/ .van-tabs--line .van-tabs__wrap {
    padding-top: 20px;
    .van-tabs__nav--line {
      background: transparent;
      .van-tab {
        color: #090707;
        font-size: 32px;
      }
      .van-tabs__line {
        height: 15px;
      }
    }
  }
  .doni {
    font-size: 28px;
    height: 1266px;
    width: 100%;
    padding-top: 120px;
    text-align: center;
  }
}
</style>
